<!doctype html>
<html class="no-js" lang="">
<head>
  <meta charset="utf-8">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  <title></title>
  <meta name="description" content="">
  <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
  <link rel="stylesheet" href="<?php echo basename(__DIR__) ?>/css/main.css">
</head>
<body>
<?php require_once __DIR__ . '/db.php' ?>
<?php require_once __DIR__ . '/error-handler.php' ?>
<?php $link = connect() ?>
    <table class="flat-table">
        <tbody>
            <tr>
              <th>No</th>
              <th>Ciudad</th>
              <th>Distrito</th>
              <th>Población</th>
              <th>País</th>
              <th>Continente</th>
              <th>Región</th>
            </tr>
            <?php $i = 0 ?>
            <?php $use_generator = isset($_REQUEST['gen']) ? $_REQUEST['gen'] : false ?>
            <?php $rows = $use_generator ? get_cities_details_using_generator($link) : get_cities_details_traditional_style($link) ?>
            <?php foreach ($rows as $row): ?>
            <?php   dump_to_console(sprintf('HTML > Volcando detalles de la fila: %u', ++$i)) ?>
            <tr>
                <td><?php echo $i ?></td>
                <td><?php echo $row['CityName'] ?></td>
                <td><?php echo $row['District'] ?></td>
                <td><?php echo $row['Population'] ?></td>
                <td><?php echo $row['CountryName'] ?></td>
                <td><?php echo $row['Continent'] ?></td>
                <td><?php echo $row['Region'] ?></td>
            </tr>
            <?php endforeach ?>
        </tbody>
        <tfoot>
            <tr>
              <td colspan="7">Table CSS Style: <a href="https://codepen.io/njessen/pen/naLCv">https://codepen.io/njessen/pen/naLCv</a></td>
            </tr>
        </tfoot>
    </table>
</body>

</html>
